From 1dc0906f8931f6cd6cf311c012d1644e51d30cfb Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Fri, 27 Mar 2009 10:54:08 +0900 Subject: [PATCH] [IA64] ia64 counter part of 19374:e655cb27d085. This patch is the ia64 counter part of 19374:e655cb27d085. Signed-off-by: Isaku Yamahata --- xen/include/asm-ia64/mm.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/xen/include/asm-ia64/mm.h b/xen/include/asm-ia64/mm.h index c4da3a18e5..b7b2d39217 100644 --- a/xen/include/asm-ia64/mm.h +++ b/xen/include/asm-ia64/mm.h @@ -228,10 +228,18 @@ static inline struct domain *page_get_owner_and_reference( do { x = y; - if (unlikely((x & PGC_count_mask) == 0) || /* Not allocated? */ - unlikely(((x + 1) & PGC_count_mask) == 0) ) {/* Count overflow? */ + /* + * Count == 0: Page is not allocated, so we cannot take a reference. + * Count == -1: Reference count would wrap, which is invalid. + * Count == -2: Remaining unused ref is reserved for get_page_light(). + */ + /* + * On ia64, get_page_light() isn't defined so that it doesn't + * make sense to take care of Count == -2. + * Just for consistency with x86. + */ + if ( unlikely(((x + 2) & PGC_count_mask) <= 2) ) return NULL; - } y = cmpxchg_acq(&page->count_info, x, x + 1); } while (unlikely(y != x)); @@ -247,7 +255,8 @@ static inline int get_page(struct page_info *page, if (likely(owner == domain)) return 1; - put_page(page); + if (owner != NULL) + put_page(page); /* if (!domain->is_dying) */ /* XXX: header inclusion hell */ gdprintk(XENLOG_INFO, -- 2.30.2